<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>持明法洲后台系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link type="text/css" href="${pageContext.request.contextPath}/layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="${pageContext.request.contextPath}/layui/layui.js"></script>
    <script type="text/javascript">
        layui.use(['layer', 'form','tree','jquery','element','table'], function(){
            var layer = layui.layer
            var form = layui.form;
            var tree = layui.tree
            var table = layui.table;
            var $=layui.jquery
            var element=layui.element;


            $.ajax({
                url:"selectAllResource"
                ,success:function (data) {
                    var menustr=''

                    $.each(data,function (i,val) {
                        menustr+="<li class=\"layui-nav-item "
                        if (i == 0) {
                            menustr+="layui-nav-itemed"
                        }
                        menustr +="\">\n" +
                            "                    <a href=\"javascript:;\">"+val.name+"</a>\n" +
                            "                    <dl class=\"layui-nav-child\">";
                        $.each(val.secondResource,function (i,val2) {
                            menustr +="<dd><a href=\"javascript:addTab("+val2.id+",'"+val2.name+"','"+val2.url+"')\">"+val2.name+"</a></dd>"
                        })
                        menustr +="</dl>\n" +
                        "                </li>"
                    })

                    $("#cmfz").html(menustr)
                    element.render('nav')
                }

            })


        });



        function addTab(id,name,url) {
            var $= layui.jquery
            var element = layui.element;
            //alert(000)
            if ($("li[lay-id='"+id+"']").length==0){
                element.tabAdd('demo', {
                    title: name
                    ,content: '<iframe src='+url+' frameborder="0" id="demoAdmin" style="width: 100%; height: 500px;"></iframe>' //支持传入html
                    ,id: id
                });
            }
            element.tabChange("demo", id);
        }


    </script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">持明法洲后台系统</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="">控制台</a></li>
            <li class="layui-nav-item"><a href="">商品管理</a></li>
            <li class="layui-nav-item"><a href="">用户</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">其它系统</a>
                <dl class="layui-nav-child">
                    <dd><a href="">邮件管理</a></dd>
                    <dd><a href="">消息管理</a></dd>
                    <dd><a href="">授权管理</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    贤心
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">退了</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" id="cmfz" lay-filter="test">
                <%--<li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">科室管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:selectDepartment(1.1)">科室展示</a></dd>
                    </dl>
                </li>
                --%>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
            <div class="layui-tab" lay-filter="demo" lay-allowclose="true">
                <ul class="layui-tab-title">
                    <li class="layui-this">欢迎页</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">欢迎登录</div>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>



</body>
</html>